<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<title>Tableau de bord : un cinéma</title>

	<link rel="stylesheet" href="../styles/style.css" />
</h:head>

<h:body>
	<h:panelGroup rendered="#{loginBean.loginSucces}">
		<ui:include src="../includes/header.xhtml" />
		<ui:include src="../includes/menu.xhtml" />

		<div id="content">
			<h2>Tableau de bord</h2>
	
	
			<div id="tableauBordUnCinema_parametres">
				<h:form id="form">
					<div class="tableauBordUnCinema_parametre" id="tableauBordUnCinema_parametre_cam_courbe">
						<div class="tableauBordUnCinema_parametre_label" id="tableauBordUnCinema_parametre_cam_courbe_label">
							Type
						</div>
					
						<div class="tableauBordUnCinema_parametre_contenu" id="tableauBordUnCinema_parametre_cam_courbe_contenu">
							<p:selectOneButton value="#{tableauBordReseauBean.type}">
								<f:selectItem itemLabel=" % " itemValue="piechart" />  
								<f:selectItem itemLabel="Nb" itemValue="linechart" />
							</p:selectOneButton>
						</div>
					</div>
					
					<div class="tableauBordUnCinema_parametre" id="tableauBordUnCinema_parametre_critere">
						<div class="tableauBordUnCinema_parametre_label" id="tableauBordUnCinema_parametre_critere_label">
							Critère
						</div>
					
						<div class="tableauBordUnCinema_parametre_contenu" id="tableauBordUnCinema_parametre_critere_contenu">
							<p:selectOneMenu value="#{tableauBordReseauBean.critere}">
								<f:selectItem itemLabel="Genre de film" itemValue="genreFilm" />
								<f:selectItem itemLabel="Type de spectateur" itemValue="typeSpectateur" />
								<f:selectItem itemLabel="Toutes les entrées" itemValue="toutesEntrees" />
							</p:selectOneMenu>
						</div>
					</div>
					
					<div class="tableauBordUnCinema_parametre" id="tableauBordUnCinema_parametre_date_debut">
						<div class="tableauBordUnCinema_parametre_label" id="tableauBordUnCinema_parametre_date_debut_label">
							Date début
						</div>
					
						<div class="tableauBordUnCinema_parametre_contenu" id="tableauBordUnCinema_parametre_date_debut_contenu">
							<p:calendar value="#{tableauBordReseauBean.dateDebut}" id="date_debut" 
										size="9" pattern="dd/MM/yyyy" required="true" label="Date Début" />
						</div>
					</div>
	
					<div class="tableauBordUnCinema_parametre" id="tableauBordUnCinema_parametre_date_fin">
						<div class="tableauBordUnCinema_parametre_label" id="tableauBordUnCinema_parametre_date_fin_label">
							Date fin
						</div>
					
						<div class="tableauBordUnCinema_parametre_contenu" id="tableauBordUnCinema_parametre_date_fin_contenu">
							<p:calendar value="#{tableauBordReseauBean.dateFin}" id="date_fin" 
										size="9" pattern="dd/MM/yyyy" required="true" label="Date Fin" />
							
						</div>
					</div>
					
					<div class="tableauBordUnCinema_parametre" id="tableauBordUnCinema_parametre_valider">
	
						<p:commandButton
							value="Valider"
							icon="ui-icon-check"
							ajax="false"
							id="valider"
							actionListener="#{tableauBordReseauBean.valide}" />
							
					</div>
				<div class="clear"></div>
				<div id="tableauBordUnCinema_parametre_message_erreur">
					<p:message for="date_debut" />
					<p:message for="date_fin" />
				</div>
				</h:form>
			</div>
			<hr class="tableauBordUnCinema_hr" />
			
			<div id="tableauBordUnCinema_schema">
				
					<p:panel id="piechart_panel" rendered="#{tableauBordReseauBean.type == 'piechart'}">
						<p:pieChart id="piechart" 
									value="#{tableauBordReseauBean.pieModel}"
									legendPosition="e"
									fill="false"
									showDataLabels="true"  
		                			title="#{tableauBordReseauBean.chartTitle}"
		                			style="width:600px;height:500px;margin: auto"
		                			sliceMargin="5"
		                			diameter="350"
		                			animate="true" /> 
					</p:panel>
					
					
					<p:panel id="linechart_panel" rendered="#{tableauBordReseauBean.type == 'linechart'}">
						<p:lineChart id="linear" 
									value="#{tableauBordReseauBean.linearModel}"
									legendPosition="e"  
									title="#{tableauBordReseauBean.chartTitle}"
									style="height:500px"
									animate="true"/> 
					</p:panel>
					
			</div>
		</div>


		<ui:include src="../includes/footer.xhtml" />

	</h:panelGroup>

	<h:panelGroup rendered="#{!loginBean.loginSucces}">
		<ui:include src="../includes/authError.xhtml" />
	</h:panelGroup>

</h:body>
</html>